Cells throughout the body need to be supplied with oxygen in order to metabolize, and metabolism generates carbon dioxide as a by-product. The primary roll of the lungs is to oxygenate RBCs so they can supply oxygen to metabolizing cellss and to bring carbon dioxide from metabolizing cells back to the lung, so it can be expired. The graphic on the right illustrates that blood returning to the heart is deoxygenated (shown in blue) and returns to the right atrium of the heart and then to the right ventricle. When the heart contracts, blood in the right ventricle is pumped to the lungs where it enters capillary vessels that circulate around the alveoli where gas exchange takes place. As blood from the pulmonary artery circulates around the alveoli, it becomes reoxygenated, and carbon dioxide moves from the pulmonary arterial blood into the alveolus to be exhaled.

Blood returning to the left atrium of the heart and then to to left ventricle is fully oxygenated, and when the heart contracts again, it is pumped into the aorta to be distributed throughout the body via the arterial system.